package cn.wenhe9.novel.service.impl;

import cn.wenhe9.novel.domain.dto.HomeBookDto;
import cn.wenhe9.novel.domain.dto.HomeFriendLinkDto;
import cn.wenhe9.novel.manager.FriendLinkCacheManager;
import cn.wenhe9.novel.manager.HomeBookCacheManager;
import cn.wenhe9.novel.result.ResultResponse;
import cn.wenhe9.novel.service.HomeService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 首页模块 服务实现类
 *
 * @author DuJinliang
 * 2022/5/18
 */
@Service
public class HomeServiceImpl implements HomeService {

    @Resource
    private HomeBookCacheManager homeBookCacheManager;

    @Resource
    private FriendLinkCacheManager friendLinkCacheManager;

    @Override
    public ResultResponse<List<HomeBookDto>> listHomeBooks() {
        return ResultResponse.ok(homeBookCacheManager.listHomeBooks());
    }

    @Override
    public ResultResponse<List<HomeFriendLinkDto>> listHomeFriendLinks() {
        return ResultResponse.ok(friendLinkCacheManager.listFriendLinks());
    }
}
